<?php
/**
 * This class implements nothing (cause it is abstract)
 *
 * @author Thomas Kappel
 * @copyright Copyright (c) 2008
 * @version $Id: Abstract.php 1877 2008-02-19 18:09:30Z p_frischmuth $
 */

abstract class Network_Abstract {
	public $_Name            = false;   // string:          name of the network
	public $user_id          = 0;       // string:          user id within the network
  public $me               = false;   // array:           all information about the user(account) himself 
  public $contacts         = false;   // array of arrays: data of contacts 

	public $activation_link  = false;   // string: url of the login page (optional)
  
  public function __construct() {
  }

  /**
   * @param name of method to ask for
   * @return boolean
   */
  public function supports($method) {
    switch($method) {
      case "find_friends_of_friends"         : return false; // get lists of members associated to another person
      case "multiple_accounts"               : return false; // one person should have only one account 
      case "require_requests_for_friendship" : return false; // need to send messages to members in order to mark them as contacts
      case "save_friends_to_network"         : return false; // support adding contacts via Socializr
      case "search_members"                  : return false; // find account of a person you already know
      case "disconnect"                      : return false; 
      default                                : return false;
    }
    return false;
  }
  
	/**
	 * @return URL of the Social Network Service
	 */  
  public function getServiceHomepage() {}

	/**
	 * @return associative array of arrays:
	 *  "mandatory" => required fields for logging in (for example: "uri", "user", "pass")
	 *  "optional"  => some more allowed fields
	 */  
  public function getAccountingRequirements() {}

	/**
	 * establishes connection to the network
	 * 
	 * @param: URI, username, password (all optional, depending on the network)
	 * @return: information about the user or false on error
	 */
	public function connect($URI="", $user="", $pass="") {}

	/**
	 * @return boolean - true if connection is already established
	 */
	public function connected() {}

	/**
	 * close connection
	 * 
	 * @return: boolean (true on success)
	 */
	public function disconnect() {}

	/**
	 * @return: array of account names of contacts
	 */
	function fetchContacts() {}
	
	/**
	 * @param: id of a contact
	 * @return: standardised associative array of information about the user
	 *           - foaf attributes
	 *           - one element with the key "full_data" contains all fetchable information
	 * @return false on error
	 */
	function fetchContact($friend) {}

  /**
   * @param: associative array of personal data defined by FOAF
   * @return: array of matching accounts (and the urls of their profile pages)
   */
  public function findPerson($contact) {}

	/**
	 * @param: contact information (as returned by fetchContact())
	 * @return: unique identifier of this account within the network
	 */
	public function getAccountIdentifier($contact) {}

	/**
	 * needs not to be implemented
	 * @return: nothing
	 */	
	public function do_get_session() {}

	/**
	 * // realized by redirection by connect()
	 * @return string: url of login page 
	 */
	// public function getLoginSiteUrl() {}

	/**
	 * @return object: instance of this class
	 */
  public static function getInstance() {}

	/**
	 * check if two persons know each other (planned feature)
	 * 
	 * @param   string: account name 
	 * @param   string: another account name 
	 * @returns boolean: true, if the contacts are contacts of each other
	 */
	public function areContacts($contact1, $contact2) {}

  /**
   * @param   string: account name of the other person
   * @param   string: message to be sent to the person
   * @returns void; false on obvious error
   */
	public function setAsFriend($accountName, $messageToUser = "") {}
	
	/**
	 * @param array: contact
	 * @return false or array
	 */
	public function search($contact) {
    return false;
  }
	
}
?>
